package com.gjl.app.oauth.endpoint;

import com.gjl.app.oauth.common.OauthConstants;
import com.gjl.app.oauth.params.OauthParam;

public class Consumer {

	private String consumerKey;
	
	private String consumerSecret;
	
	private String callback;
	
	private String scope;
	
	private OauthParam oauthParam;
	
	/**
	 * 
	 * @param key
	 * @param secret
	 * @param callback
	 */
	public Consumer(String key, String secret, String callback) {
		this.consumerKey = key;
		this.consumerSecret = secret;
		this.callback = callback;
		this.oauthParam = new OauthParam();
		oauthParam.put(OauthConstants.CONSUMER_KEY, consumerKey);
		oauthParam.put(OauthConstants.CONSUMER_SECRET, consumerSecret);
		oauthParam.put(OauthConstants.CALLBACK, callback);
	}
	
	/**
	 * Special Constructor for google OAUTH
	 * 
	 * @param key the consumer key
	 * @param secret the consumer secret
	 * @param callback the callback url
	 * @param scope scope, this is not specified in OAUTH SPEC, just for google only
	 * 
	 */
	public Consumer(String key, String secret, String callback, String scope) {
		this(key, secret, callback);
		this.scope = scope;
		oauthParam.put(OauthConstants.SCOPE, scope);
	}

	public String getConsumerKey() {
		return consumerKey;
	}

	public void setConsumerKey(String consumerKey) {
		this.consumerKey = consumerKey;
	}

	public String getConsumerSecret() {
		return consumerSecret;
	}

	public void setConsumerSecret(String consumerSecret) {
		this.consumerSecret = consumerSecret;
	}

	public OauthParam getOauthParam() {
		return oauthParam;
	}

	public void setOauthParam(OauthParam oauthParam) {
		this.oauthParam = oauthParam;
	}

	public String getCallback() {
		return callback;
	}

	public void setCallback(String callback) {
		this.callback = callback;
	}

	public String getScope() {
		return scope;
	}

	public void setScope(String scope) {
		this.scope = scope;
	}

}
